<style scoped>
</style>
<template>
  <van-field v-bind="$attrs"
             :readonly="is_info"
             :placeholder="placeholder"
             :name="is_info?'':name"
             :model-value="modelValue" >
  </van-field>
</template>

<script>
export default {
  name: "__",
  props: {
    name: String,
    modelValue: [String,Number],
    config: [String,Object],
    placeholder: String,
    is_info: Boolean,
  },
  emits: ['update:modelValue','change'],
  data(){
    return {
      need_display: true, //定义当modelValue变动时是否需要渲染，用来阻止当前组件变动 modelValue 后重新渲染
      options: [],
      content: "",
      value_arr: [],
      option_arr: [],
    }
  },
  methods: {
    display(){
    },
    change(value_arr){
      let val = value_arr.length ? value_arr.join(",") : "";
      this.need_display = false;
      setTimeout(()=>{this.need_display=true},10)
      this.$emit('update:modelValue', val);
      this.$emit('change', val);
    }
  },
  watch: {
    config(v){
      this.display();
    },
    modelValue(){
      if (this.need_display) this.display();
    },
  },
  computed: {},
  mounted() {
    this.display();
  }
}
</script>